from selenium import webdriver

url = 'https://baidu.com'

# 创建Chrome浏览器的配置对象
options = webdriver.ChromeOptions()
# # 设置无界面模式
# options.add_argument('--headless')
# 设置不用GPU
options.add_argument('--disable-gpu')
# # 设置代理
# options.add_argument('--proxy-server=http://123.121.165.249:8888')
# 替换user-agent
options.add_argument('--user-agent=Mozilla/5.0 houjiatao')

driver = webdriver.Chrome(
    executable_path=r'E:\ChromeDriver\chromedriver_win32/chromedriver.exe',
    chrome_options=options
)

driver.get(url)
driver.maximize_window()

driver.save_screenshot('./baidu_到此一游.png')

